using System;

namespace CSharp_1209.PropertyDemo
{
    public class Register
    {
        private int age;
        private string profession;
        private double membershipFee;

        public string Profession
        {
            get { return profession; }
            set { profession = value; }
        }

        public double MembershipFee
        {
            get { return membershipFee; }
            set { membershipFee = value; }
        }

        public int Age
        {
            set
            {
                if (value <= 0)
                {
                    Console.WriteLine("Age cannot be negative or zero");
                    return;
                }

                if (value <= 6)
                {
                    Console.WriteLine("You are too young to access the library");
                    return;
                }

                age = value;
            }
            get
            {
                return age;
            }
        }

        // Auto-Property
        public string MemberName { get; set; }
        public string City { get; set; }
    }
}
